﻿@{
    ViewBag.Title = "Login";
    Layout = "~/Views/Shared/LogLayout.cshtml";
}

@section scripts{
    <script type="text/javascript">
        $(function () {

            $(".user,.mima").keypress(function (e) {
                if (e.keyCode == 13) {
                    $("#login").trigger("click");
                }
            })

            $("#login").click(function () {
                var UserName = $.trim($(".user").val())
                if (UserName == "") {
                    $(".form-message").css({ "visibility": "visible" });
                    $(".tag").text("请输入用户名！");
                    $(".user").focus();
                    return;
                }
                var Password = $.trim($(".mima").val());
                if (Password == "") {
                    $(".form-message").css({ "visibility": "visible" });
                    $(".tag").text("请输入密码！");
                    $(".mima").focus();
                    return;
                }

                $(".tag").hide();
                $(".loading").show();

                $.post("/Account/Login", { UserName: UserName, UserPassword: Password }, function (data) {

                    if (data.result) {
                        var taskurl = $("#taskurl").val();
                        if (taskurl == "" || taskurl == "/") {
                            window.location.href = "/Home/Index";
                        } else {
                            window.location.href = taskurl;
                        }
                    } else {
                        $(".loading").hide();
                        //  $(".form-message").css({ "visibility": "visible" });
                        $(".tag").text(data.message).show();
                    }
                });
            });
        });

    </script>
}
@Html.Hidden("taskurl", ViewBag.TaskUrl as string);
<div class="logo">

</div>
<div class="contain">
    <div class="LoginTitle">
         欢迎使用本系统 
    </div>
    <div class="Loginform">
        <div class="form-message">
            <div class="loading">
                <img src="../Images/loginloading.gif" />&nbsp;&nbsp;&nbsp;登陆中......
            </div>
            <div class="tag">输入密码不正确</div>
        </div>
        <div class="form-account">
            <input class="user" type="text" placeholder="请输入邮箱/手机号" value="admin" />
        </div>
        <div class="form-password">
            <input class="mima" type="password" placeholder="请输入6位数字密码" value="123456" />
        </div>
        <div>
            <button type="submit" id="login">登　录</button>
        </div>
    </div>
</div>
<div class="copyright">
    <p>适用浏览器：IE8以上、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. </p>
    <p> ©2017 - 2017 All Rights Reserved By 小小语信息技术股份有限公司</p>
    <p>投诉邮箱：mapy06@163.com</p>
</div>